package controler;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import vue.MainIHM;

public class Controler implements ActionListener {

	// Main IHM link
	private MainIHM ihm = null;
	
	// subcontroler for hard-drive interactions
	private LoadSaveManager loadSaveManager = null;
	
	public Controler() {
		loadSaveManager = new LoadSaveManager(this);
		loadSaveManager.saveProperties();
	}
	
	public File getCurrentWorkspace() {
		return loadSaveManager.getWorkspace();
	}
	
	public MainIHM getIhm() {
		return ihm;
	}
	
	public static void main(String[] args) {
		Controler controler = new Controler();
		MainIHM ihm = new MainIHM(controler);
		controler.ihm = ihm;
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		ActionE action = ActionE.valueOf(e.getActionCommand());
		
		if(action.hasExecutor()) {
			action.executeAction(this, e.getActionCommand());
		} else {
			switch(action) {
				default: 
					break;
			}
		}
		
	}
	
	public void closeAllWatchers() {

	}
	
	public LoadSaveManager getLoadSaveManager() {
		return loadSaveManager;
	}

}
